<template>
    <h1 style="text-align: center;margin-top: 90px;">护工消毒</h1>
    <div style="text-align: center;margin-top: 40px;">
        <div>
            <input type="checkbox" v-model="ruleForm.replaceBedSheet"/>更换床单
            <input type="checkbox" v-model="ruleForm.replaceBedding" />更换被褥
        </div>
        <br>
        <div>
            <input type="checkbox" v-model="ruleForm.disinfect" />消毒液擦拭床头柜
            <input type="checkbox" v-model="ruleForm.emit" />枕头紫外线照射
        </div>
        <br>
        <div>
            <input type="checkbox" v-model="ruleForm.replaceMattress" />更换床垫
            <input type="checkbox" v-model="ruleForm.outDisinfect" />出院消毒
        </div>
        <br>
        <el-button type="primary" @click="Add">
            确定
        </el-button>
        <el-button @click="">取消</el-button>
    </div>
</template>

<script lang="ts" setup>
import http from '@/api/http';
import { ElMention, ElMessage } from 'element-plus'
import { reactive, ref } from 'vue'
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();

let item = JSON.parse(typeof route.query.item === 'string' ? route.query.item : '{}')

console.log("这里", item)
const ruleForm: any = reactive({
    id: 0,
    porterId: item.sosName,
    wardAreaId: item.wardAreaCode,
    wardId: item.wardCode,
    bedId: item.bedCode,
    replaceBedSheet: 0,
    replaceBedding: 0,
    disinfect: 0,
    emit: 0,
    replaceMattress: 0,
    outDisinfect: 0
})

const Add = () => {
    if(ruleForm.replaceBedSheet)
    {
        ruleForm.replaceBedSheet=1
    }
     if(ruleForm.replaceBedding)
    {
        ruleForm.replaceBedding=1
    }
     if(ruleForm.disinfect)
    {
        ruleForm.disinfect=1
    }
     if(ruleForm.emit)
    {
        ruleForm.emit=1
    }
     if(ruleForm.replaceMattress)
    {
        ruleForm.replaceMattress=1
    }
     if(ruleForm.outDisinfect)
    {
        ruleForm.outDisinfect=1
    }
    console.log("ruleform", ruleForm)
    http.post(`/api/NurseManageController/AddPorterWorkDetail`, ruleForm)
        .then(res => {
            if (res.data > 0) {
                ElMessage.success("添加成功");
                router.push("/PorterWorkButton")
            }
        })
}


</script>